import { getStrColor } from '/src/utils/process'

// 分割用`-`连接的标签属性，返回数组。包含名字和随机颜色
export const splitTags = (tags) => {
  tags = tags || '' // 防止返回非数组
  return tags
    .split('-')
    .map((x) => ({ name: x, color: getStrColor(x) }))
    .filter((i) => !!i.name)
}

export const keysOfArticle = [
  'id',
  'title',
  'content',
  'tagsName',
  'description',
  'difficulty',
  'thumbnail',
]
